package Lab12Package;

//package Lab12Package;

//随机生成10个数，并对10个数进行排序。

public class Lab12_12 {
	public static void main(String[] args) {
		double[] a = new double[10];
		System.out.println("排序前的随机数");
		for (int i = 0; i < a.length; i++) {
			a[i] = Math.random() * 100;
			System.out.printf("%.1f ", a[i]);
		}
		for (int i = 0; i < 10; i++) {
			for (int j = 0; j < a.length - i - 1; j++) {
				if (a[j] > a[j + 1]) {
					double temp = a[j];
					a[j] = a[j + 1];
					a[j + 1] = temp;
				}
			}
		}
		System.out.println("\n排序后的数");
		for (int i = 0; i < a.length; i++) {
			System.out.printf("%.1f ", a[i]);
		}

	}

}
